//
//  MyGroupTableViewCell.m
//  MyYiJianKangApp
//
//  Created by 张国文 on 16/4/8.
//  Copyright © 2016年 hangzhouyijiyin. All rights reserved.
//

#import "MyGroupTableViewCell.h"

@implementation MyGroupTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addMySubview];
    }
    return self;
}

// 布局
- (void)addMySubview
{
    // 头像
    self.groupImageV = [[UIImageView alloc] initWithFrame:CGRectMake(20 * kAdjustParamater, 10 * kAdjustParamater, 50 * kAdjustParamater, 50 * kAdjustParamater)];
    self.groupImageV.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.groupImageV.layer.cornerRadius = self.groupImageV.width / 2;
    self.groupImageV.layer.masksToBounds = YES;
    [self.contentView addSubview:_groupImageV];
    
    // 标题
    self.groupNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.groupImageV.right + 12 * kAdjustParamater, 25 * kAdjustParamater, 200 * kAdjustParamater, 20 * kAdjustParamater)];
    self.groupNameLabel.textColor = [UIColor blackColor];
 //   self.groupNameLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.groupNameLabel.textAlignment = NSTextAlignmentLeft;
    self.groupNameLabel.font = [UIFont systemFontOfSize:k16Big];
    [self.contentView addSubview:_groupNameLabel];
    
    // 人形头像
    self.peopleImageV = [[UIImageView alloc] initWithFrame:CGRectMake(280 * kAdjustParamater, 25 * kAdjustParamater, 20 * kAdjustParamater, 20 * kAdjustParamater)];
    self.peopleImageV.image = [UIImage imageNamed:@"小人-01"];
    [self.contentView addSubview:_peopleImageV];
    
    // 人数
    self.memberCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.peopleImageV.right + 6 * kAdjustParamater, 27 * kAdjustParamater, 50 * kAdjustParamater, 15 * kAdjustParamater)];
  //  self.memberCountLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    self.memberCountLabel.textAlignment = NSTextAlignmentLeft;
    self.memberCountLabel.textColor = kYellowColor;
    self.memberCountLabel.font  = [UIFont systemFontOfSize:k13Big];
    [self.contentView addSubview:_memberCountLabel];

}

- (void)setModel:(MyGroupModel *)model
{
    self.groupNameLabel.text = model.name;
    self.memberCountLabel.text = [NSString stringWithFormat:@"%@人", model.memberCount];
}


@end
